home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 April: Mac OS SDK / Dev.CD Apr 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / CIncludes / Folders.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-17  |  12.2 KB  |  335 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Folders.h
  3.  
  4.      Contains:    Folder Manager Interfaces.
  5.  
  6.      Version:    Technology:    Mac OS 8
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1995-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __FOLDERS__
  18. #define __FOLDERS__
  19.  
  20. #ifndef __MACTYPES__
  21. #include <MacTypes.h>
  22. #endif
  23.  
  24.  
  25.  
  26. #if PRAGMA_ONCE
  27. #pragma once
  28. #endif
  29.  
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33.  
  34. #if PRAGMA_IMPORT
  35. #pragma import on
  36. #endif
  37.  
  38. #if PRAGMA_STRUCT_ALIGN
  39.     #pragma options align=mac68k
  40. #elif PRAGMA_STRUCT_PACKPUSH
  41.     #pragma pack(push, 2)
  42. #elif PRAGMA_STRUCT_PACK
  43.     #pragma pack(2)
  44. #endif
  45.  
  46.  
  47. enum {
  48.     kOnSystemDisk                = -32768L                        /* previously was 0x8000 but that is an unsigned value whereas vRefNum is signed*/
  49. };
  50.  
  51.  
  52. enum {
  53.     kCreateFolder                = true,
  54.     kDontCreateFolder            = false
  55. };
  56.  
  57.  
  58. enum {
  59.     kSystemFolderType            = FOUR_CHAR_CODE('macs'),        /* the system folder */
  60.     kDesktopFolderType            = FOUR_CHAR_CODE('desk'),        /* the desktop folder; objects in this folder show on the desk top. */
  61.     kTrashFolderType            = FOUR_CHAR_CODE('trsh'),        /* the trash folder; objects in this folder show up in the trash */
  62.     kWhereToEmptyTrashFolderType = FOUR_CHAR_CODE('empt'),        /* the "empty trash" folder; Finder starts empty from here down */
  63.     kPrintMonitorDocsFolderType    = FOUR_CHAR_CODE('prnt'),        /* Print Monitor documents */
  64.     kStartupFolderType            = FOUR_CHAR_CODE('strt'),        /* Finder objects (applications, documents, DAs, aliases, to...) to open at startup go here */
  65.     kShutdownFolderType            = FOUR_CHAR_CODE('shdf'),        /* Finder objects (applications, documents, DAs, aliases, to...) to open at shutdown go here */
  66.     kAppleMenuFolderType        = FOUR_CHAR_CODE('amnu'),        /* Finder objects to put into the Apple menu go here */
  67.     kControlPanelFolderType        = FOUR_CHAR_CODE('ctrl'),        /* Control Panels go here (may contain INITs) */
  68.     kExtensionFolderType        = FOUR_CHAR_CODE('extn'),        /* System extensions go here */
  69.     kFontsFolderType            = FOUR_CHAR_CODE('font'),        /* Fonts go here */
  70.     kPreferencesFolderType        = FOUR_CHAR_CODE('pref'),        /* preferences for applications go here */
  71.     kTemporaryFolderType        = FOUR_CHAR_CODE('temp')        /* temporary files go here (deleted periodically, but don't rely on it.) */
  72. };
  73.  
  74. /*
  75.     Note:     The FindFolder trap was not implemented until System 7.  If you want to call FindFolder
  76.             while running on System 6 machines, then define USE_FINDFOLDER_GLUE and link with
  77.             Interface.o which contains glue to implement FindFolder on pre-System 7 machines.
  78. */
  79. #ifdef USE_FINDFOLDER_GLUE
  80. EXTERN_API( OSErr )
  81. FindFolder                        (short                     vRefNum,
  82.                                  OSType                 folderType,
  83.                                  Boolean                 createFolder,
  84.                                  short *                foundVRefNum,
  85.                                  long *                    foundDirID);
  86.  
  87. #else
  88. EXTERN_API( OSErr )
  89. FindFolder                        (short                     vRefNum,
  90.                                  OSType                 folderType,
  91.                                  Boolean                 createFolder,
  92.                                  short *                foundVRefNum,
  93.                                  long *                    foundDirID)                            TWOWORDINLINE(0x7000, 0xA823);
  94.  
  95. #endif  /* defined(USE_FINDFOLDER_GLUE) */
  96.  
  97. EXTERN_API( OSErr )
  98. ReleaseFolder                    (short                     vRefNum,
  99.                                  OSType                 folderType)                            TWOWORDINLINE(0x700B, 0xA823);
  100.  
  101.  
  102. #if !TARGET_OS_MAC
  103. /* Since non-mac targets don't know about VRef's or DirID's, the Ex version returns
  104.    the found folder path.
  105.  */
  106. EXTERN_API_C( OSErr )
  107. FindFolderEx                    (short                     vRefNum,
  108.                                  OSType                 folderType,
  109.                                  Boolean                 createFolder,
  110.                                  short *                foundVRefNum,
  111.                                  long *                    foundDirID,
  112.                                  char *                    foundFolder);
  113.  
  114. #endif  /* !TARGET_OS_MAC */
  115.  
  116. /******************************************/
  117. /* Extensible Folder Manager declarations */
  118. /******************************************/
  119.  
  120. /****************************/
  121. /* Folder Manager constants */
  122. /****************************/
  123.  
  124.  
  125. enum {
  126.     kExtensionDisabledFolderType = FOUR_CHAR_CODE('extD'),
  127.     kControlPanelDisabledFolderType = FOUR_CHAR_CODE('ctrD'),
  128.     kSystemExtensionDisabledFolderType = FOUR_CHAR_CODE('macD'),
  129.     kStartupItemsDisabledFolderType = FOUR_CHAR_CODE('strD'),
  130.     kShutdownItemsDisabledFolderType = FOUR_CHAR_CODE('shdD'),
  131.     kApplicationsFolderType        = FOUR_CHAR_CODE('apps'),
  132.     kDocumentsFolderType        = FOUR_CHAR_CODE('docs')
  133. };
  134.  
  135.  
  136. enum {
  137.                                                                 /* new constants */
  138.     kVolumeRootFolderType        = FOUR_CHAR_CODE('root'),        /* root folder of a volume */
  139.     kChewableItemsFolderType    = FOUR_CHAR_CODE('flnt'),        /* items deleted at boot */
  140.     kApplicationSupportFolderType = FOUR_CHAR_CODE('asup'),        /* third-party items and folders */
  141.     kTextEncodingsFolderType    = FOUR_CHAR_CODE('ƒtex'),        /* encoding tables */
  142.     kStationeryFolderType        = FOUR_CHAR_CODE('odst'),        /* stationery */
  143.     kOpenDocFolderType            = FOUR_CHAR_CODE('odod'),        /* OpenDoc root */
  144.     kOpenDocShellPlugInsFolderType = FOUR_CHAR_CODE('odsp'),    /* OpenDoc Shell Plug-Ins in OpenDoc folder */
  145.     kEditorsFolderType            = FOUR_CHAR_CODE('oded'),        /* OpenDoc editors in MacOS Folder */
  146.     kOpenDocEditorsFolderType    = FOUR_CHAR_CODE('ƒodf'),        /* OpenDoc subfolder of Editors folder */
  147.     kOpenDocLibrariesFolderType    = FOUR_CHAR_CODE('odlb'),        /* OpenDoc libraries folder */
  148.     kGenEditorsFolderType        = FOUR_CHAR_CODE('ƒedi'),        /* CKH general editors folder at root level of Sys folder */
  149.     kHelpFolderType                = FOUR_CHAR_CODE('ƒhlp'),        /* CKH help folder currently at root of system folder */
  150.     kInternetPlugInFolderType    = FOUR_CHAR_CODE('ƒnet'),        /* CKH internet plug ins for browsers and stuff */
  151.     kModemScriptsFolderType        = FOUR_CHAR_CODE('ƒmod'),        /* CKH modem scripts, get 'em OUT of the Extensions folder */
  152.     kPrinterDescriptionFolderType = FOUR_CHAR_CODE('ppdf'),        /* CKH new folder at root of System folder for printer descs. */
  153.     kPrinterDriverFolderType    = FOUR_CHAR_CODE('ƒprd'),        /* CKH new folder at root of System folder for printer drivers */
  154.     kScriptingAdditionsFolderType = FOUR_CHAR_CODE('ƒscr'),        /* CKH at root of system folder */
  155.     kSharedLibrariesFolderType    = FOUR_CHAR_CODE('ƒlib'),        /* CKH for general shared libs. */
  156.     kVoicesFolderType            = FOUR_CHAR_CODE('fvoc'),        /* CKH macintalk can live here */
  157.     kControlStripModulesFolderType = FOUR_CHAR_CODE('sdev'),    /* CKH for control strip modules */
  158.     kAssistantsFolderType        = FOUR_CHAR_CODE('astƒ'),        /* SJF for Assistants (MacOS Setup Assistant, etc) */
  159.     kUtilitiesFolderType        = FOUR_CHAR_CODE('utiƒ'),        /* SJF for Utilities folder */
  160.     kAppleExtrasFolderType        = FOUR_CHAR_CODE('aexƒ'),        /* SJF for Apple Extras folder */
  161.     kContextualMenuItemsFolderType = FOUR_CHAR_CODE('cmnu'),    /* SJF for Contextual Menu items */
  162.     kMacOSReadMesFolderType        = FOUR_CHAR_CODE('morƒ'),        /* SJF for MacOS ReadMes folder */
  163.     kALMModulesFolderType        = FOUR_CHAR_CODE('walk'),        /* EAS for Location Manager Module files except type 'thng' (within kExtensionFolderType) */
  164.     kALMPreferencesFolderType    = FOUR_CHAR_CODE('trip'),        /* EAS for Location Manager Preferences (within kPreferencesFolderType; contains kALMLocationsFolderType) */
  165.     kALMLocationsFolderType        = FOUR_CHAR_CODE('fall'),        /* EAS for Location Manager Locations (within kALMPreferencesFolderType) */
  166.     kColorSyncProfilesFolderType = FOUR_CHAR_CODE('prof'),        /* for ColorSync™ Profiles */
  167.     kThemesFolderType            = FOUR_CHAR_CODE('thme'),        /* for Theme data files */
  168.     kFavoritesFolderType        = FOUR_CHAR_CODE('favs'),        /* Favorties folder for Navigation Services */
  169.     kInternetFolderType            = FOUR_CHAR_CODE('intƒ'),        /* Internet folder (root level of startup volume) */
  170.     kAppearanceFolderType        = FOUR_CHAR_CODE('appr'),        /* Appearance folder (root of system folder) */
  171.     kSoundSetsFolderType        = FOUR_CHAR_CODE('snds'),        /* Sound Sets folder (in Appearance folder) */
  172.     kDesktopPicturesFolderType    = FOUR_CHAR_CODE('dtpƒ'),        /* Desktop Pictures folder (in Appearance folder) */
  173.     kInternetSearchSitesFolderType = FOUR_CHAR_CODE('issf'),    /* Internet Search Sites folder */
  174.     kFindSupportFolderType        = FOUR_CHAR_CODE('fnds'),        /* Find support folder */
  175.     kFindByContentFolderType    = FOUR_CHAR_CODE('fbcf'),        /* Find by content folder */
  176.     kInstallerLogsFolderType    = FOUR_CHAR_CODE('ilgf'),        /* Installer Logs folder */
  177.     kScriptsFolderType            = FOUR_CHAR_CODE('scrƒ'),        /* Scripts folder */
  178.     kFolderActionsFolderType    = FOUR_CHAR_CODE('fasf'),        /* Folder Actions Scripts folder */
  179.     kLauncherItemsFolderType    = FOUR_CHAR_CODE('laun'),        /* Launcher Items folder */
  180.     kRecentApplicationsFolderType = FOUR_CHAR_CODE('rapp'),        /* Recent Applications folder */
  181.     kRecentDocumentsFolderType    = FOUR_CHAR_CODE('rdoc'),        /* Recent Documents folder */
  182.     kRecentServersFolderType    = FOUR_CHAR_CODE('rsvr'),        /* Recent Servers folder */
  183.     kSpeakableItemsFolderType    = FOUR_CHAR_CODE('spki')        /* Speakable Items folder */
  184. };
  185.  
  186.  
  187. /* FolderDescFlags values */
  188.  
  189. enum {
  190.     kCreateFolderAtBoot            = 0x00000002,
  191.     kFolderCreatedInvisible        = 0x00000004,
  192.     kFolderCreatedNameLocked    = 0x00000008
  193. };
  194.  
  195. typedef UInt32                             FolderDescFlags;
  196. /* FolderClass values */
  197.  
  198. enum {
  199.     kRelativeFolder                = FOUR_CHAR_CODE('relf'),
  200.     kSpecialFolder                = FOUR_CHAR_CODE('spcf')
  201. };
  202.  
  203. typedef OSType                             FolderClass;
  204. /* special folder locations */
  205.  
  206. enum {
  207.     kBlessedFolder                = FOUR_CHAR_CODE('blsf'),
  208.     kRootFolder                    = FOUR_CHAR_CODE('rotf')
  209. };
  210.  
  211. typedef OSType                             FolderType;
  212. typedef OSType                             FolderLocation;
  213.  
  214.  
  215. struct FolderDesc {
  216.     Size                             descSize;
  217.     FolderType                         foldType;
  218.     FolderDescFlags                 flags;
  219.     FolderClass                     foldClass;
  220.     FolderType                         foldLocation;
  221.     OSType                             badgeSignature;
  222.     OSType                             badgeType;
  223.     UInt32                             reserved;
  224.     StrFileName                     name;                        /* Str63 on MacOS*/
  225. };
  226. typedef struct FolderDesc                FolderDesc;
  227. typedef FolderDesc *                    FolderDescPtr;
  228.  
  229.  
  230. typedef UInt32                             RoutingFlags;
  231.  
  232. struct FolderRouting {
  233.     Size                             descSize;
  234.     OSType                             fileType;
  235.     FolderType                         routeFromFolder;
  236.     FolderType                         routeToFolder;
  237.     RoutingFlags                     flags;
  238. };
  239. typedef struct FolderRouting            FolderRouting;
  240. typedef FolderRouting *                    FolderRoutingPtr;
  241. /* routing constants */
  242. /***************************/
  243. /* Folder Manager routines */
  244. /***************************/
  245. /* Folder Manager administration routines */
  246. EXTERN_API( OSErr )
  247. AddFolderDescriptor                (FolderType             foldType,
  248.                                  FolderDescFlags         flags,
  249.                                  FolderClass             foldClass,
  250.                                  FolderLocation         foldLocation,
  251.                                  OSType                 badgeSignature,
  252.                                  OSType                 badgeType,
  253.                                  ConstStrFileNameParam     name,
  254.                                  Boolean                 replaceFlag)                        TWOWORDINLINE(0x7020, 0xA823);
  255.  
  256. EXTERN_API( OSErr )
  257. GetFolderDescriptor                (FolderType             foldType,
  258.                                  Size                     descSize,
  259.                                  FolderDesc *            foldDesc)                            TWOWORDINLINE(0x7023, 0xA823);
  260.  
  261. EXTERN_API( OSErr )
  262. GetFolderTypes                    (UInt32                 requestedTypeCount,
  263.                                  UInt32 *                totalTypeCount,
  264.                                  FolderType *            theTypes)                            TWOWORDINLINE(0x7024, 0xA823);
  265.  
  266. EXTERN_API( OSErr )
  267. RemoveFolderDescriptor            (FolderType             foldType)                            TWOWORDINLINE(0x7021, 0xA823);
  268.  
  269. /* legacy routines */
  270. EXTERN_API( OSErr )
  271. GetFolderName                    (short                     vRefNum,
  272.                                  OSType                 foldType,
  273.                                  short *                foundVRefNum,
  274.                                  StrFileName             name)                                TWOWORDINLINE(0x700E, 0xA823);
  275.  
  276. /* routing routines */
  277. EXTERN_API( OSErr )
  278. AddFolderRouting                (OSType                 fileType,
  279.                                  FolderType             routeFromFolder,
  280.                                  FolderType             routeToFolder,
  281.                                  RoutingFlags             flags,
  282.                                  Boolean                 replaceFlag)                        TWOWORDINLINE(0x7026, 0xA823);
  283.  
  284. EXTERN_API( OSErr )
  285. RemoveFolderRouting                (OSType                 fileType,
  286.                                  FolderType             routeFromFolder)                    TWOWORDINLINE(0x7027, 0xA823);
  287.  
  288. EXTERN_API( OSErr )
  289. FindFolderRouting                (OSType                 fileType,
  290.                                  FolderType             routeFromFolder,
  291.                                  FolderType *            routeToFolder,
  292.                                  RoutingFlags *            flags)                                TWOWORDINLINE(0x7022, 0xA823);
  293.  
  294. EXTERN_API( OSErr )
  295. GetFolderRoutings                (UInt32                 requestedRoutingCount,
  296.                                  UInt32 *                totalRoutingCount,
  297.                                  Size                     routingSize,
  298.                                  FolderRouting *        theRoutings)                        TWOWORDINLINE(0x701E, 0xA823);
  299.  
  300. EXTERN_API( OSErr )
  301. InvalidateFolderDescriptorCache    (short                     vRefNum,
  302.                                  long                     dirID)                                TWOWORDINLINE(0x7025, 0xA823);
  303.  
  304. EXTERN_API( OSErr )
  305. IdentifyFolder                    (short                     vRefNum,
  306.                                  long                     dirID,
  307.                                  FolderType *            foldType)                            TWOWORDINLINE(0x701F, 0xA823);
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315. #if PRAGMA_STRUCT_ALIGN
  316.     #pragma options align=reset
  317. #elif PRAGMA_STRUCT_PACKPUSH
  318.     #pragma pack(pop)
  319. #elif PRAGMA_STRUCT_PACK
  320.     #pragma pack()
  321. #endif
  322.  
  323. #ifdef PRAGMA_IMPORT_OFF
  324. #pragma import off
  325. #elif PRAGMA_IMPORT
  326. #pragma import reset
  327. #endif
  328.  
  329. #ifdef __cplusplus
  330. }
  331. #endif
  332.  
  333. #endif /* __FOLDERS__ */
  334.  
  335.